#ifndef RESETPSWDIALOG_H
#define RESETPSWDIALOG_H
#include<global.h>
#include <QDialog>
#include<errorqueuemgr.h>
namespace Ui {
class ResetpswDialog;
}

class ResetpswDialog : public QDialog
{
    Q_OBJECT

public:
    explicit ResetpswDialog(QWidget *parent = nullptr);
    ~ResetpswDialog();
    void InitHandler();
    void setupconnection();

signals:
    void SwitchToLogin();
    void countdown();
    void SwitchTowait();

private slots:
    void slot_req_finish_http(ReqId id,QString res,Ecode error);
    void on_cancel_btn_clicked();
    void onPasswordTextChanged();
    void onRepswTextChanged();
    void onEmailTextChanged();
    void onVerifyTextChanged(const QString& text);

    void on_get_code_btn_clicked();

    void on_confirm_btn_clicked();

private:
    ErrorQueueManager m_errormgr;
    Ui::ResetpswDialog *ui;
    std::unordered_map<ReqId,std::function<void(QJsonObject &)>> m_handler;
    bool validateField(const QString& fieldId, const QString& value);
};

#endif // RESETPSWDIALOG_H
